package Q2;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static int n;
    public static int m;
    public static int[] arr;
    public static List<List<Integer>> ret = new ArrayList<>();

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        n = scanner.nextInt();
        m = scanner.nextInt();
        arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = i + 1;
        }

        dfs(0, new ArrayList<>());

        for (List<Integer> list : ret) {
            for (int num : list) {
                System.out.print(num + " ");
            }
            System.out.println();
        }
    }

    public static void dfs(int index, List<Integer> list) {
        if (index == n) {
            int sum = 0;
            for (int num : list) {
                sum += num;
            }
            if (sum == m) {
                ret.add(new ArrayList<>(list));
            }

            return;
        }

        //选
        list.add(arr[index]);
        dfs(index + 1, list);
        //回溯
        list.remove(list.size() - 1);

        //不选
        dfs(index + 1, list);
    }
}
